using System;
using System.ComponentModel;
//using PostSharp.Laos;

namespace CosyTrade.Data
{
    [Serializable]
    internal class PropertyWriteIntercept //: OnMethodBoundaryAspect
    {
        //private readonly string propertyName;
        //private object oldValue;

        //public PropertyWriteIntercept(string propertyName)
        //{
        //    this.propertyName = propertyName;
        //}

        //public override void OnEntry(MethodExecutionEventArgs eventArgs)
        //{
        //    oldValue = eventArgs.Instance.GetType().GetProperty(propertyName).GetValue(eventArgs.Instance, null);
        //    base.OnEntry(eventArgs);
        //}

        //public override void OnSuccess(MethodExecutionEventArgs eventArgs)
        //{
        //    PropertyChangedNotifyImplementation implementation =
        //        (PropertyChangedNotifyImplementation)((IComposed<INotifyPropertyChanged>)eventArgs.Instance).
        //                                                  GetImplementation(eventArgs.InstanceCredentials);

        //    object newValue = eventArgs.Instance.GetType().GetProperty(propertyName).GetValue(eventArgs.Instance, null);
        //    if (!Equals(oldValue, newValue)) implementation.OnPropertyChanged(propertyName);
        //}
    }
}